-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evil-collection: respect evil-overriding-maps #506
Conversation
Hmnn, I'm very hesitant to support respecting this evil-override-map. IIRC, ideally we'd want to get away from override maps in the first place. Secondly, I'm not sure all the implications of each comment here:
What if evil-collection wanted to define a,b,c,d,e,f but the overriding map was nil? Why would overriding be non nil but the cdr of overriding be nil? When would that happen?
What if evil-collection wanted to define a,b,c,d,e,f but the overriding map was a,b,c? What would happen to the d,e,f? |
The cdr of (evil-collection-define-key 'normal 'Info-mode-map
"h" 'evil-backward-char) But
evil-collection will skip a,b,c and evil-collection-define-key only in d,e,f. |
Could you elaborate more here? What do you expect to happen before this change and what do you expect to happen after this change, and why?
I'm not sure that's what we want. |
Oh, I found the example is wrong. All modes should have hjkl, e.g. But if So we must manually use But is it user expected? If a keymap is in So that we try to respect the After this patch, we can delete tons of redundant keybdings. If (evil-collection-define-key 'normal 'dictionary-mode-map
;; motion
(kbd "l") 'evil-forward-char ; otherwise bound to `dictionary-previous'
(kbd "h") 'evil-backward-char ; otherwise bound to `dictionary-help'
(kbd "p") 'ignore ; otherwise bound to `backward-button'
(kbd "n") 'evil-search-next ; otherwise bound to `forward-button'
;; mouse
[mouse-1] 'link-selected
;; misc
"g?" 'dictionary-help ; normally under `h` which is rebound here
(kbd "C-o") 'dictionary-previous) ; normally under `l` which is rebound here l/h/p/n can be removed safely. The diff in #501 also reflects the benefit. |
Yes, we want 'h' to be 'evil-backward-char'.
That's expected and wanted. In this case, the reasoning is 'this mode binds 'h' to something random, lets change it back to what a user would expect'.
That's not necessarily true. It could be that another mode (say evil-vars) is binding it for them without their intention.
If I'm understanding what you're saying, this isn't true. We'd be removing bindings -and also- changing what those bindings do. Just going by your example, all the 'redundant' binds of hjkl that we've added to various modes will become what evil-overriding-map has in its map right? In this case, the binds in evil-collection serves a purpose of rebinding to hjkl.
From my quick skim through there, I'd say the problems lie in evil using those override maps for those various modes. Somewhat related: #48 |
Do you mean using |
Yes.
Maybe that's not a bad idea, let me think on this further. |
I think it may be worth looking at where evil uses evil-overriding-maps and see if we can maybe PR something where -evil-want-binding- gates those maps from being set. That's already what we're doing with the evil-keybindings file in evil. e.g. https://github.com/emacs-evil/evil/blob/5c28294d830a5a79e9b9da2c32e7675d52d76720/evil.el#L141 |
|
Is there something to be done here @condy0919 ? I think we don't want to support this (evil-collection respecting evil-overriding-maps)? |
Yes. But we could prompt a diagnostic message to encourage user to set (unless evil-overriding-maps
(message "Make sure to set `evil-overriding-maps' to nil before loading evil \
or evil-collection.")) |
It's probably OK to not prompt them, maybe a documentation change is all we need. If we do prompt them, we'd also need a way to disable the prompt for the users already aware but don't care for the message. |
Ok. I will raise an another PR later. |
Respect
evil-overriding-maps
.If
dictionary-mode-map
is inevil-overriding-maps
,h
/l
/n
/p
will notbe overridden by evil. Currently
evil-collection
overrides theses keys, seehttps://github.com/emacs-evil/evil-collection/blob/master/modes/dictionary/evil-collection-dictionary.el#L42-L45
If
evil-overriding-maps
is'()
(default now),h
,l
,n
andp
will be defined by evil as these are the basic keys. In such a case,evil-collection
needn't to redefine. It will help us to maintain less keybindings.